package com.cqupt.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;


import java.io.File;

/**
 * @author 蒋俊贤
 * @version 1.0
 */
@Controller
public class PictureController {

    @RequestMapping("/test1_1")
    @ResponseBody
    public String test1_1(@RequestParam("file") MultipartFile file) {
        String res = "";
        try {
            String basepath = "E:/CQUPT_Juan/idea_project/boss-system/src/picture";
            String filename = file.getOriginalFilename();
            res = basepath+ File.separator+filename;
            file.transferTo(new File(res));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return res;
    }


}
